#ifndef MXNET_PREDICT_H
#define MXNET_PREDICT_H
#include <fstream>
#include <iomanip>
#include <iostream>
#include <string>
#include <unistd.h>
#include <vector>


#include <opencv2/opencv.hpp>

using namespace std;
using namespace cv;

class CrowdCountPredictor {
public:
  CrowdCountPredictor(const std::string &param_file,
                      const std::string &json_file, int batch, int channel,
                      int input_h, int input_w, string input_name, int ngpuid);
  ~CrowdCountPredictor();

  size_t run(cv::Mat img, cv::Rect rect);

private:
  void *init(const std::string &param_file, const std::string &json_file,
             int batch, int channel, int input_h, int input_w);

  int LoadFile(const std::string &fname, std::vector<char> &buf);

  void set_input_buffer(std::vector<cv::Mat> &input_channels, float *input_data,
                        const int height, const int width);

  void *Net_;
  int ngpuid_;
  int num_channels_;
  int input_h_;
  int input_w_;
  string input_name_;
};

#endif // MXNET_PREDICT_H
